exports.addExtensionFunctionModule = function (req, res) {

    //获取参数信息
    var bodyParams = req.routeInfo.bodyParams;

    //任务流创建
    async.waterfall([

        (cb) => {

            //查询是否已安装过该模块
            R.SEND_HTTP(
                req,
                res,
                {
                    url: CORE_APIConfig.coreAPI.sysOrganizationalFunctionModuleSearch.Request_Api_Url + "/fm_fmid/" + bodyParams.fm_fmid,
                    method : 'GET'
                },
                function (data) {

                    if(data.result.data.length > 0){

                        return RES.errorResponse(res, false, "抱歉，您已安装过该模块了");

                    }

                    cb()
                
                }
            )

        },

        (cb) => {

            //获取模块信息
            R.SEND_HTTP(
                req,
                res,
                {
                    url: CORE_APIConfig.coreAPI.sysOrganizationalFunctionModuleAdd.Request_Api_Url,
                    method : 'POST',
                    data   : bodyParams
                },
                function (data) {

                    cb()

                }
            )

        }

    ], ()=> {

        //返回最终拼接结果
        RES.successResponse(res);

    });

}